<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="parent">
        <p id="one">hello</p>
    </div>
    <button id="add">change</button>
    <script>
        /*增加节点 语法 parentNode.appendChild(childNode)*/
        var add=document.getElementById("add");
        var parent=document.getElementById("parent");
        var one=document.getElementById("one");
        add.onclick=function(){
            let p=document.createElement("p");
            let p1=document.createElement("p");
            let text=document.createTextNode("first");
            let text1=document.createTextNode("last");
            p.appendChild(text);
            p1.appendChild(text1);
            parent.appendChild(p1);
            parent.insertBefore(p,one);
           
        }
    </script>
</body>
</html>